<!DOCTYPE html>
<html lang="en">
	<head>
		<title> New Document </title>
		<meta charset="utf-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- Bootstrap -->
		<link href="${webRoot}resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<link href="${webRoot}resources/css/style.css" rel="stylesheet">
		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
	</head>
<body class="main">
	<div class="wrap">
		<div class="">
		<ul class="breadcrumb">
		    <li><span id="test">您当前的位置：</span><a href="#">首页</a> <span class="divider">>></span></li>
		    <li class="active">${listContribution}</li>
	    </ul>
	    <!--  
			<form class="form-inline">
				<input type="text" class="input-small" id="userName" placeholder="会员名">
				<input type="text" class="input-small" id="usertelephone" placeholder="手机号">			
				<button type="button" class="btn" onclick="serachHref();">搜索</button>
			</form>-->
		</div>
		<div id="div">
		<div class="">
			<table class="table table-bordered table-striped table-hover">
				<thead>
					<tr>
						<th>投稿人</th>
						<th>投稿内容</th>
						<th>投稿时间</th>
						<th>投稿内容板块</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<#if contributionList?exists>
				<#list contributionList as contributionEntity>
					<tr>
						<td>${contributionEntity.username}</td>
						<td>${contributionEntity.content}</td>
						<td>${contributionEntity.time?string("yyyy-MM-dd HH:mm:ss")}</td>
						<td>${contributionEntity.title}</td>
						<td><a href="javascript:deleteContribution(${contributionEntity.id})">删除</a></td>
					</tr>
				</#list>
				<#else>
				   	 <tr>
				       <td colspan="6">没有查询到记录！</td>
				   </tr>
				</#if>
				</tbody>
			</table>			
		</div>
		<#if contributionList?exists>
		<div class="pagination pagination-right">
		  <input type="hidden" name="userSelectBean" id="userSelectBean" value="${memberEntity}"/>
		  <ul>
		    <#if pageEntity.page==1>
		    <li class="disabled"><a href="#">&laquo;</a></li>
		    <#else>
		    <li><a href="javascript:pageHref(${pageEntity.page-1},${pageEntity.totalPage},${pageEntity.pageSize})">&laquo;</a></li>
		    </#if>
		    <#list 1..pageEntity.totalPage as i>
		         <#if pageEntity.page==i>
		    <li class="active"><a href="#">${i}</a></li>
		         <#else>
		    <li><a href="javascript:pageHref(${i},${pageEntity.totalPage},${pageEntity.pageSize})">${i}</a></li>
		        </#if>
		    </#list>
		   <#if pageEntity.page==pageEntity.totalPage>
		    <li class="disabled"><a href="#">»</a></li>
		    <#else>
		    <li><a href="javascript:pageHref(${pageEntity.page+1},${pageEntity.totalPage},${pageEntity.pageSize})">»</a></li>
		    </#if>
		  </ul>
		</div>
		</#if>
		</div>				
	</div>			
	<script src="${webRoot}resources/js/bootstrap.min.js"></script>
	<script src="${webRoot}resources/js/js.js"></script>
	<script type="text/javascript">
	    function pageHref(page,totalPage,pageSize){
	    	$.ajax({url:"${webRoot}contribution/contributionAjaxList.do?page="+page+"&pageSize="+pageSize+
	    			"&totalPage="+totalPage,
				   type:"post",
				   cache:"false",
				   error : function() {
					   alert("系统繁忙，请稍后再试！");
					},
				   success:function(msg){
					   $(".main").html(msg);
				   }
				});
	    }
	    function serachHref(){
	    	var userName = $("#userName").val();
	    	var userTelephone = $("#usertelephone").val();
	    	$.ajax({url:"${webRoot}member/memberAjaxList.do?member_Nick_Name="+userName+"&member_Phone="+userTelephone,
				   type:"post",
				   cache:"false",
				   error : function() {
					   alert("系统繁忙，请稍后再试！");
					},
				   success:function(msg){
					   $("#div").html(msg);
				   }
				});
	    }
	
	    function deleteContribution(id){
				if(confirm("确定删除该投稿吗？")){
			    	$.ajax({url:"${webRoot}contribution/deleteContribution.do?contributionId="+id,
						   type:"delete",
						   cache:"false",
						   error : function() {
							   alert("系统繁忙，请稍后再试！");
							},
						   success:function(msg){
							   $(".main").html(msg);
						   }
						});
					}
		}
	    
	    function upCirl(id){
		    	$.ajax({url:"${webRoot}cirl/upCirl.do?cirlId="+id,
					   type:"post",
					   cache:"false",
					   error : function() {
						   alert("系统繁忙，请稍后再试！");
						},
					   success:function(msg){
						   $("#div").html(msg);
					   }
					});
	}
	</script>
</body>
</html>
